package leetcode.dfs;

import leetcode.dfs.common.DFSUtils;
import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution1022 {
    public int sumRootToLeaf(TreeNode root) {
        return DFSUtils.sumRootToLeaf(root);
    }
}

public class leetcode1022 {
    public static void main(String[] args) {
        Solution1022 solution1022 = new Solution1022();
        Integer[] nums = {1, 0, 1, 0, 1, 0, 1};
        System.out.println(solution1022.sumRootToLeaf(TreeUtils.generateLeetcodeTree(nums)));
    }
}
